API Documentation
Public Member Functions | List of all members
nkGraphics::Node Class Reference

Represents a node in a scene graph. More...

Inheritance diagram for nkGraphics::Node:
nkExport::Exportable nkGraphics::Camera nkGraphics::Light

Public Member Functions

virtual void setPositionRelative (const nkMaths::Vector &value)
 
virtual void setPositionAbsolute (const nkMaths::Vector &value)
 
virtual void translateRelative (const nkMaths::Vector &value)
 
virtual void translateAbsolute (const nkMaths::Vector &value)
 
nkMaths::Vector getPositionRelative () const
 
nkMaths::Vector getPositionAbsolute ()
 
virtual void setOrientationRelative (const nkMaths::Quaternion &value)
 
virtual void setOrientationAbsolute (const nkMaths::Quaternion &value)
 
virtual void rotateRelative (const nkMaths::Quaternion &value)
 
virtual void rotateAbsolute (const nkMaths::Quaternion &value)
 
nkMaths::Quaternion getOrientationRelative () const
 
nkMaths::Quaternion getOrientationAbsolute ()
 
virtual void setScaleRelative (const nkMaths::Vector &value)
 
virtual void setScaleAbsolute (const nkMaths::Vector &value)
 
virtual void applyScale (const nkMaths::Vector &value)
 
nkMaths::Vector getScaleRelative () const
 
nkMaths::Vector getScaleAbsolute ()
 
nkMaths::Matrix getLocalTransform ()
 
nkMaths::Matrix getAbsoluteTransform ()
 
void updateTransformations ()
 
void dispatchDirtyTransform ()
 
nkMaths::Vector getAbsoluteUp ()
 
nkMaths::Vector getAbsoluteFront ()
 
nkMaths::Vector getAbsoluteRight ()
 
NodegetParentNode () const
 
NodeaddChildNode ()
 
NodeaddChildNode (const std::string_view &name)
 
void addChildNode (Node *node)
 
NodegetChildNode (unsigned int index) const
 
unsigned int getNumChildNode () const
 
void insertIntoTreeFrom (Node *parent)
 
void detachFromTree ()
 
std::string_view getName () const
 
bool getHidden () const
 
void setHidden (bool value)
 
void addEntityToTrack (Entity *entity)
 
void stopEntityTracking (Entity *entity)
 
unsigned int getTrackedEntityCount () const
 
EntitygetTrackedEntity (unsigned int index) const
 
void registerListener (NodeChangeListener *listener)
 
void unregisterListener (NodeChangeListener *listener)
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable ()
 
virtual ~Exportable ()
 

Detailed Description

Represents a node in a scene graph.

The graph can be used whenever transformations of entities are needed.

Member Function Documentation

◆ setPositionRelative()

virtual void nkGraphics::Node::setPositionRelative ( const nkMaths::Vector value)
virtual

Sets the position of the node, relative to its parent.

Parameters
valueThe position to set.

Reimplemented in nkGraphics::Camera.

◆ setPositionAbsolute()

virtual void nkGraphics::Node::setPositionAbsolute ( const nkMaths::Vector value)
virtual

Sets the position of the node, absolute in the world.

Parameters
valueThe position to use.

Reimplemented in nkGraphics::Camera.

◆ translateRelative()

virtual void nkGraphics::Node::translateRelative ( const nkMaths::Vector value)
virtual

Translates the node, relative to its parent.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ translateAbsolute()

virtual void nkGraphics::Node::translateAbsolute ( const nkMaths::Vector value)
virtual

Translates a node, absolute in the world.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getPositionRelative()

nkMaths::Vector nkGraphics::Node::getPositionRelative ( ) const
Returns
The position of the node, relative to its parent.

◆ getPositionAbsolute()

nkMaths::Vector nkGraphics::Node::getPositionAbsolute ( )
Returns
The position of the node, absolute in the world.

◆ setOrientationRelative()

virtual void nkGraphics::Node::setOrientationRelative ( const nkMaths::Quaternion value)
virtual

Sets the orientation of a node, relative to its parent.

Parameters
valueThe orientation to set.

Reimplemented in nkGraphics::Camera.

◆ setOrientationAbsolute()

virtual void nkGraphics::Node::setOrientationAbsolute ( const nkMaths::Quaternion value)
virtual

Sets the orientation of a node, absolute in the world.

Parameters
valueThe orientation to set.

Reimplemented in nkGraphics::Camera.

◆ rotateRelative()

virtual void nkGraphics::Node::rotateRelative ( const nkMaths::Quaternion value)
virtual

Rotates a node, relative to its parent.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ rotateAbsolute()

virtual void nkGraphics::Node::rotateAbsolute ( const nkMaths::Quaternion value)
virtual

Rotates a node, absolute in the world.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getOrientationRelative()

nkMaths::Quaternion nkGraphics::Node::getOrientationRelative ( ) const
Returns
The orientation of the node, relative to its parent.

◆ getOrientationAbsolute()

nkMaths::Quaternion nkGraphics::Node::getOrientationAbsolute ( )
Returns
The orientation of the node, absolute in the world.

◆ setScaleRelative()

virtual void nkGraphics::Node::setScaleRelative ( const nkMaths::Vector value)
virtual

Sets the scale of the node, relative to its parent.

Parameters
valueThe scale to set.

Reimplemented in nkGraphics::Camera.

◆ setScaleAbsolute()

virtual void nkGraphics::Node::setScaleAbsolute ( const nkMaths::Vector value)
virtual

Sets the scale of the node, absolute in the world.

Parameters
valueThe scale to set.

Reimplemented in nkGraphics::Camera.

◆ applyScale()

virtual void nkGraphics::Node::applyScale ( const nkMaths::Vector value)
virtual

Scales the node by a factor.

Parameters
valueThe offset to add.

Reimplemented in nkGraphics::Camera.

◆ getScaleRelative()

nkMaths::Vector nkGraphics::Node::getScaleRelative ( ) const
Returns
The scale of the node, relative to its parent.

◆ getScaleAbsolute()

nkMaths::Vector nkGraphics::Node::getScaleAbsolute ( )
Returns
The scale of the node, absolute in the world.

◆ getLocalTransform()

nkMaths::Matrix nkGraphics::Node::getLocalTransform ( )
Returns
The full transformation of the node, relative to its parent.

◆ getAbsoluteTransform()

nkMaths::Matrix nkGraphics::Node::getAbsoluteTransform ( )
Returns
The full transformation of the node, absolute.

◆ updateTransformations()

void nkGraphics::Node::updateTransformations ( )

Updates the transformation of a node. Used internally.

◆ dispatchDirtyTransform()

void nkGraphics::Node::dispatchDirtyTransform ( )

Dispatches a dirty transform flag to the children. Used internally.

◆ getAbsoluteUp()

nkMaths::Vector nkGraphics::Node::getAbsoluteUp ( )
Returns
The up vector, absolute in the world.

◆ getAbsoluteFront()

nkMaths::Vector nkGraphics::Node::getAbsoluteFront ( )
Returns
The front vector, absolute in the world.

◆ getAbsoluteRight()

nkMaths::Vector nkGraphics::Node::getAbsoluteRight ( )
Returns
The right vector, absolute in the world.

◆ getParentNode()

Node* nkGraphics::Node::getParentNode ( ) const
Returns
The parent node.

◆ addChildNode() [1/3]

Node* nkGraphics::Node::addChildNode ( )

Adds a child node.

Returns
The freshly created child node.
Remarks
This call will go through the NodeManager::create() function. As a result, the manager owns memory returned.

◆ addChildNode() [2/3]

Node* nkGraphics::Node::addChildNode ( const std::string_view &  name)

Adds a child node, with a given name.

Returns
The freshly created child node.
Remarks
This call will go through the NodeManager::createOrRetrieve() function. As a result, the manager owns memory returned.

◆ addChildNode() [3/3]

void nkGraphics::Node::addChildNode ( Node node)

Adds an existing node as a child.

Parameters
nodeThe node to add.

◆ getChildNode()

Node* nkGraphics::Node::getChildNode ( unsigned int  index) const
Parameters
indexThe index of the child to retrieve.
Returns
The child node if available, nullptr else.

◆ getNumChildNode()

unsigned int nkGraphics::Node::getNumChildNode ( ) const
Returns
The number of children nodes.

◆ insertIntoTreeFrom()

void nkGraphics::Node::insertIntoTreeFrom ( Node parent)

Inserts the node in a tree.

Parameters
parentThe node which will be the parent.

◆ detachFromTree()

void nkGraphics::Node::detachFromTree ( )

Detaches a node from the local tree it is in.

◆ getName()

std::string_view nkGraphics::Node::getName ( ) const
Returns
The name of the node.

◆ getHidden()

bool nkGraphics::Node::getHidden ( ) const
Returns
Whether the node is hidden from project exporting (true) or not (false).

◆ setHidden()

void nkGraphics::Node::setHidden ( bool  value)

Sets whether the node should not export itself during a project (resource set) export. This can be used to hide programmatically generated resources from duplicating in the export.

Parameters
valueWhether the node should be hidden (true) or not (false).

◆ addEntityToTrack()

void nkGraphics::Node::addEntityToTrack ( Entity entity)

Tracks entity for changes. Used internally, in theory external code should not used it. Rather, see Entity::setParentNode().

◆ stopEntityTracking()

void nkGraphics::Node::stopEntityTracking ( Entity entity)

Stops tracking an entity for its changes. Used internally, in theory external code should not used it. Rather, see Entity::setParentNode().

◆ getTrackedEntityCount()

unsigned int nkGraphics::Node::getTrackedEntityCount ( ) const
Returns
The number of entities currently tracked by the node.

◆ getTrackedEntity()

Entity* nkGraphics::Node::getTrackedEntity ( unsigned int  index) const
Parameters
indexThe index of the tracked entity to retrieve.
Returns
Requested entity if available, nullptr else.

◆ registerListener()

void nkGraphics::Node::registerListener ( NodeChangeListener listener)

Register a listener.

Parameters
listenerThe listener to register.

◆ unregisterListener()

void nkGraphics::Node::unregisterListener ( NodeChangeListener listener)

Unregister a listener.

Parameters
listenerThe listener to unregister.

◆ exportClassToTree()

virtual void nkGraphics::Node::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Basic exporting capabilities.

Parameters
rootNodeThe tree to export to.

Implements nkExport::Exportable.

Reimplemented in nkGraphics::Camera.

◆ importClassFromTree()

virtual void nkGraphics::Node::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Basic importing capabilities.

Parameters
rootNodeThe tree to import from.

Implements nkExport::Exportable.

Reimplemented in nkGraphics::Camera.


The documentation for this class was generated from the following file: